<template>
  <div class="header">
    <div>学生信息后台管理系统</div>
    <router-link to="/login">
      <p class="login">
        <i class="el-icon-user"></i>
        <!-- 当user_name有值时使用的是user_name 当user_name没有值时使用登录 -->
        <!-- <span>登录</span>
        <span>{{ user_name }}</span> -->
        <span>{{ user_name ? user_name : "登录" }}</span>
      </p>
    </router-link>
  </div>
</template>

<script>
import { mapState } from "vuex";
export default {
  name: "",
  props: [""],
  data() {
    return {};
  },

  components: {},

  computed: {
    ...mapState(["user_name"]),
  },

  beforeMount() {},

  mounted() {},

  methods: {},

  watch: {},
};
</script>
<style lang='css' scoped>
.header {
  display: flex;
  justify-content: space-between;
  padding: 0 50px;
  height: 50px;
  background-color: #172c47;
  line-height: 50px;
  font-size: 30px;
  font-weight: 700;
  color: #f5f5f5;
}
.login {
  font-size: 20px;
  font-weight: 400;
}
a {
  text-decoration: none;
  color: #f5f5f5;
}
.router-link-active {
  color: red;
}
</style>